< previous page page_471 next page >

Page 471
e10a6a0a59f035e870d90cca05b85fce.gif
' Create the surface.
Private Sub CreateData()
Const Subdivisions = 3
Const MajorDx = 0.6
Const MajorDz = 0.6
Const MinorDx = MajorDx / Subdivisions
Const MinorDz = MajorDz / Subdivisions
Const NumX = -2 * Xmin / MajorDx
Const NumZ = -2 * Zmin / MajorDz

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim X As Single
Dim Y As Single
Dim Z As Single
Dim x1 As Single
Dim y1 As Single
Dim z1 As Single
Dim x2 As Single
Dim y2 As Single
Dim z2 As Single
Dim pline As Polyline3d

    Set TheGrid = New RefinedGrid3d

    SphereRadius = (Xmin + 3 * MajorDx) * (Xmin + 3 * MajorDx)

    ' Make polylines parallel to the X axis.
    X = Xmin
    For i = 1 To NumX
        Set pline = New Polyline3d
        z1 = Zmin
         ' Get the starting point.
        y1 = YValue(X, z1)
        For j = 1 To NumZ - 1
            For k = 1 To Subdivisions
                z2 = z1 + MinorDz
                y2 = YValue(X, z2)
                pline.AddSegment X, y1, z1, X, y2, z2
                y1 = y2 
                z1 = z2 
            Next k 
        Next j 
        TheGrid.Polylines.Add pline 
         
        X = X + MajorDx 
    Next i 

    ' Make polylines parallel to the Z axis. 
    Z = Zmin

 
< previous page page_471 next page >